;; https://github.com/thierryvolpiatto/emacs-tv-config/blob/master/init-helm-thierry.el
(helm-mode 1)
(global-set-key (kbd "M-x")                          'undefined)
(global-set-key (kbd "M-x")                          'helm-M-x)
(global-set-key (kbd "M-y")                          'helm-show-kill-ring)

(global-set-key (kbd "C-c <SPC>")                    'helm-all-mark-rings)
(global-set-key (kbd "C-x r b")                      'helm-filtered-bookmarks)
(global-set-key (kbd "C-h r")                        'helm-info-emacs)
(global-set-key (kbd "C-:")                          'helm-eval-expression-with-eldoc)
(global-set-key (kbd "C-,")                          'helm-calcul-expression)
(global-set-key (kbd "C-h d")                        'helm-info-at-point)
(global-set-key (kbd "C-h i")                        'helm-info)

(global-set-key (kbd "C-x C-f")                      'helm-find-files) ;打开文件
(global-set-key (kbd "C-x C-d")                      'helm-browse-project)
;; (global-set-key (kbd "C-x b")                        'helm-buffers-list) ;切换buffer
(global-set-key (kbd "C-x b")                        'helm-mini) ;切换buffer

(global-set-key (kbd "<f1>")                         'helm-resume)
(global-set-key (kbd "C-h C-f")                      'helm-apropos)
(global-set-key (kbd "C-h a")                        'helm-apropos)
;; (global-set-key (kbd "<f5> s")                       'helm-find)
(global-set-key (kbd "<f2>")                         'helm-execute-kmacro)
(global-set-key (kbd "C-c i")                        'helm-imenu-in-all-buffers)
;;(global-set-key (kbd "<f11> o")                      'helm-org-agenda-files-headings)
(global-set-key (kbd "C-s")                          'helm-occur)
(define-key global-map [remap jump-to-register]      'helm-register)
(define-key global-map [remap list-buffers]          'helm-mini)
(define-key global-map [remap dabbrev-expand]        'helm-dabbrev)
(define-key global-map [remap find-tag]              'helm-etags-select)
(define-key global-map [remap xref-find-definitions] 'helm-etags-select)
(define-key global-map (kbd "M-g a")                 'helm-do-grep-ag)
(define-key global-map (kbd "M-g g")                 'helm-grep-do-git-grep)
(define-key global-map (kbd "M-g i")                 'helm-gid)
(define-key global-map (kbd "C-x r p") 'helm-projects-history)


(setq  helm-apropos-fuzzy-match                        t
       helm-M-x-fuzzy-match                            t
       helm-lisp-fuzzy-completion                      t
       helm-completion-in-region-fuzzy-match           t
       helm-buffers-fuzzy-matching t
       helm-recentf-fuzzy-match t
       helm-locate-fuzzy-match t
       helm-apropos-fuzzy-match t
       helm-mode-fuzzy-match t
       )

(setq helm-mode-fuzzy-match t)
(setq helm-candidate-number-limit 20)   ;提升速度 fuzzy
;; This is your old M-x.
;; (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
(provide 'helm-config)
